package LinhDB2.Day01;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Assignment_8 {

	public static void main(String[] args) {
		int decimalNumber;
		int count = 0;
		Scanner k = new Scanner(System.in);
		try {
			System.out.print("Please input a decimal number : ");
			decimalNumber = k.nextInt();
			
			while (decimalNumber > 0) {
				if (decimalNumber % 2 != 0) {
					count++;
				}
				decimalNumber = decimalNumber / 2;
			}
			
			System.out.println("There are/is " + count + " of '1' bit(s) in binary string.");
		} catch (InputMismatchException e) {
			System.out.println("You have input a wrong value !");
		}
	}

}
